﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model_SSResourceManager;

namespace Presenter_SSResourceManager
{
    public class PresenterManageResources
    {
        private readonly ModelsManager _mModel;
        private readonly IViewManageResources _viewManageResources;
        public PresenterManageResources(IViewManageResources view)
        {
            this._viewManageResources = view;
            _mModel = ModelInstanse.Get();
        }

        public void LoadData()
        {
            IEnumerable<Resource> resources = _mModel.resourceModel.GetAll();
            _viewManageResources.SetDataForResources(resources);
            _viewManageResources.SetIdsInCollection(resources.Select(resource => resource.Id).ToList());
        }

        public void DeleteResourse(Guid id)
        {
            _mModel.resourceModel.Delete(id);
        }
    }
}
